<?php

/*
 * This script belongs to Aspect PHP.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This script is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
 * General Public License for more details.
 */

require_once 'PHPUnit/Framework.php';

/**
 * Test class for aspectAutoloader
 *
 * @package    aspectPhp
 * @subpackage test
 * @author     gboisse
 */
class aspectAutoloaderTest extends PHPUnit_Framework_TestCase {

    protected function setUp() {
        file_put_contents(dirname(__FILE__) . '/../../lib/notAspectBlablabla.php', 'class notAspectBlablabla {}');

        require_once dirname(__FILE__) . '/../../lib/aspectAutoloader.php';
        aspectAutoloader::register();
    }

    protected function tearDown() {
        unlink(dirname(__FILE__) . '/../../lib/notAspectBlablabla.php');
    }

    public function testAutoloader() {
        $this->assertTrue(class_exists('aspectAdviceChain'));
        $this->assertTrue(class_exists('aspectContainer'));
        $this->assertTrue(class_exists('aspectContainerBuilder'));
        $this->assertTrue(class_exists('aspectContainerDumper'));
        $this->assertTrue(interface_exists('aspectJoinpoint'));
        $this->assertTrue(class_exists('aspectJoinpointImpl'));
        $this->assertTrue(class_exists('aspectPointcut'));
        $this->assertTrue(class_exists('aspectPointcutFilter'));
        $this->assertTrue(class_exists('aspectProxy'));
        $this->assertTrue(class_exists('aspectUtils'));
        $this->assertFalse(class_exists('notAspectBlablabla'));
    }

}
